import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.*;
import java.lang.*;
import java.util.*;
import org.apache.commons.collections.*;

public class GetBasedStatus 
{
	public void getBasedStatus(int pos, String mapFile) throws IOException
	{
		  FileInputStream fstream = new FileInputStream(mapFile);
		  // Get the object of DataInputStream
		  DataInputStream in = new DataInputStream(fstream);
		  BufferedReader br = new BufferedReader(new InputStreamReader(in));
		  
		  Double max = -99999.0;
		  Double min = 999999.0;
		  Double ave = 0.0;
		  
		  int count = 0;
		  
		  String line = null;
		  while((line = br.readLine()) != null)
		  {
			  String words[] = line.split(",");
			  
			  Double num = Double.parseDouble(words[pos].trim());
			  
			  if (num > max)
			  {
				  max = num;
			  }
			  
			  if (num < min)
			  {
				  min = num;
			  }
			  
			  ave += num;
			  count++;
		  }
		  
		  System.out.println("max: " + max);
		  System.out.println("min: " + min);
		  System.out.println("ave: " + (ave / (double)(count)));
		  
		  
		  br.close();
	}
	

	public static void main(String args[]) throws IOException
	{
		GetBasedStatus fuyun = new GetBasedStatus();
		
		fuyun.getBasedStatus(2, "data/backup/4.0.1-complete/projRatio.csv");
	}
}
